<?php

namespace App\Http\Requests\Categorys;

use Illuminate\Foundation\Http\FormRequest;

class Categorys extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
        public function rules()
        {
            return [
                'sname' => 'required',
                'pid' => 'required',
                'descr' => 'required',
                'state' => 'required',
            ];
        }

        public function  messages()
        {
            return [
                'sname.required' => '类名不能为空',
                'pid.required' => '父类别不能为空',
                'descr.required' => '描述不能为空',
                'state.required' => '状态不能为空',
            ];
        }
}
